<?php
/* @var $this AlbumController */
/* @var $dataProvider CActiveDataProvider */

$remove_drop = CHtml::dropDownList('zpc_id','',CmpCat::model()->getCmpCat('转移到相册',3),array('class'=>'s_ipt w_120 removetoalbum'));
?>
<div class="pro_filter c_f ">
	<?php $form=$this->beginWidget('CActiveForm', array(
		'action'=>Yii::app()->createUrl($this->route),
		'method'=>'get',
	)); ?>
		<span class="mr30"> <label>选择相册：</label> 
			<?php echo $form->dropDownList($model,'zpc_id',CmpCat::model()->getCmpCat('选择相册',3),array('class'=>'s_ipt w_120','id'=>'zpc_id'))?>
		</span> 
		<span><label>排序：</label> 
			<?php echo $form->dropDownList($model,'listorder',Albums::model()->getListOrder(),array('class'=>'s_ipt w_120'))?>
		</span>
		<?php echo CHtml::submitButton(Yii::t('cmp','Search'),array('class'=>'mem_bgx mem_btn01'))?>
	<?php $this->endWidget(); ?>
</div>

<?php $this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$model->search(),
	'itemView'=>'_index_view',
	'tagName'=>'ul',
	'htmlOptions'=>array('class'=>'c_f photo_manage list-view'),
	'itemsCssClass'=>'photo_list c_f',
	'selectAll'=>array('ids[]','id[]'),
	'artLink'=>array(
			//全选删除
			array(Yii::t('cmp','批量删除'),$this->pre_module_url.'/album/delete','确认删除所选图片！'),
	),
	'batchItem'=>array(
			//转移到相册
			$remove_drop,
	),
)); ?>


<script type="text/javascript">
//全选批操作
$('.removetoalbum').bind('change',function(){
	var catid = $(this).val();
	art.dialog({
	    title: '移动图片',
	    okValue:'确认',
	    cancelValue:'取消',
	    width: 300,
	    height: 100,
	    fixed: true,
	    content: "<form id='art_dialog'  method='post' action='<?php echo $this->pre_module_url ?>/album/removeToAlbum' ><div class='updtitle'><p class='fs_14 jg' style='margin-top:10px;'>确认将所选图片转移到选择的相册吗！</p><input type='hidden' name='cat_id' value='"+catid+"'><p id='proid'></p></div></form>",
	    ok: function () {
	        $("#art_dialog").submit();
	        return false;
	    },
	    cancel: function () {
	    	return true;
	    },
	});
   var e = document.getElementsByName('id[]');	//alert(e.length)	;
   for (var i=0; i<e.length; i++){
	   if(e[i].checked){
		   $('#art_dialog').append("<input type='hidden' name='ids[]' value='"+e[i].value+"' />");
	   }
	}
})
</script>

<script src="<?php echo Yii::app()->baseUrl;?>/js/ZeroClipboard/ZeroClipboard.js"></script>  
<script type="text/javascript">
$(function(){  
    //设置ZeroClipboard.swf的路径  
    ZeroClipboard.setMoviePath("<?php echo Yii::app()->baseUrl;?>/js/ZeroClipboard/ZeroClipboard.swf");   
    $("a[id^=btnCopy_]").each(function(){  
        var clip = new ZeroClipboard.Client();    
        clip.setHandCursor(true);   
          
        var obj = $(this);  
        var id = $(this).attr("id");  
        var content = $(this).attr("copyContent");  
        clip.setText(content);    
        clip.glue(id);  
          
        //这个是复制成功后的提示    
        clip.addEventListener( "complete", function(){    
            art.dialog({
            	title: '复制图片地址',
            	okValue:'确认',
            	content:"已经复制到剪切板！<br>"+"\n"+content,
        	    ok: function () {
        	        return true;
        	    },
              }); 
        });   
    });  
});
</script>

